Azure Integration Guide
This guide outlines the steps to integrate Azure Pipelines into your development workflow. Azure Pipelines is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate building, testing, and deploying your code.
Prerequisites
- An Azure DevOps account.
- The following tools installed on your Jenkins server:
- jq: A lightweight and flexible command-line JSON processor. You can install it by following the instructions at jq installation guide.
- curl: A command-line tool to transfer data to or from a server using various protocols. You can install it by following the instructions at curl download page.
Steps
Step 1: Setting Up a New Pipeline
- Open the Azure Devops Pipelines section.
- Click on New Pipeline.
- Click on Use the classic editor to create a pipeline without YAML.
- Select Azure Repos Git from the source options.
- Configure the project, repository, and branch.
- Start with an empty job template on template selection page.
Step 2: Configuring Pipeline Options
- Configure the agent pool and agent specification with available agent within agent job section.
- Create a pipeline variable named API_KEY with the following value:
sample_api_integration_key
Step 3: Handling the Execution Script
-
Download the execute.sh file and place it in the repository.
-
Replace the placeholder text PLACE_YOUR_CURL_COMMAND_HERE on line 71 of execute.sh with the following:
curl --location false/v2/apikeyexecution/runCollection \ --header "Content-Type: application/json" \ --header "api-key: your_sample_api_key_here" \ --data '{ "projectId": "project_sample_id", "organizationId": "org_sample_id", "collectionIds": [ { "collectionId": "coll_sample_collection_id", "reqIds": [ "req_sample_id_1", "req_sample_id_2", "req_sample_id_3" ] } ], "config": { "environmentId": "env_sample_env_id", "delay": 0, "totalIterations": 1, "testDataSetId": "tdt_sample_test_data_id" } }'
in execute.sh file on line no. 71.
-
Add a task named Bash from the Add Task(+) menu.
-
Configure the Bash task with the type set to File Path.
-
In the Script Path field, add the location of the execute.sh file, and add the argument
-t ${API_KEY}
. -
Add another task named Publish Test Results from the Add Task(+) menu.
-
Select the test result format as JUnit and set the test results file to result.xml.
Step 4: Finalizing Configuration
- Save the pipeline configuration.
- Click on Run pipeline to initiate the build process and publish the test results.